\chapter{Numerical techniques}

\section{Simulation implementation} % (fold)
\label{sec:simulation_implementation}

I implement simulations of this model as C++ code, that takes advantage of Fast-Fourier transform routines provided by the optimized FFTW library. Additionally, I use the FFTW++ header class and an optimized array class provided by John Bowman \cite{Bowman_2008aa}. Typical execution times using a Dual-core Pentium D are 15 seconds per transit time.

% section simulation_implementation (end)

\section{The Box-Muller Transform} % (fold)
\label{sec:box_muller}

The Box-Muller transform is a method used to generate pairs of normally distributed random numbers from a source of uniformly distributed random numbers. The original form given by Box and Muller requires two samples from the uniform distribution on the interval $(0,1]$. This form, due to computational simplicity, was used in the numerical models I present in this thesis.

The transform is as follows:

\begin{align}
Z_0 &= R\cos{\Theta} = \sqrt{-2\ln U_1}\cos\left(2\pi U_2\right)\\
Z_1 &= R\sin{\Theta} = \sqrt{-2\ln U_1}\sin\left(2\pi U_2\right)
\end{align}

where $U_1$ and $U_2$ are independent random variables uniformly distributed on the interval $\left(0,1\right]$, and $Z_{0,1}$ are independent random variables with a normal distribution having $\sigma = 1$ and $\mu = 0$. A graphical map of the Box-Muller Transform is shown in Fig.~\ref{fig:boxmuller}.

\begin{figure}
  \begin{center}
    \includegraphics[height=8cm]{Figures/boxmuller.png}
  \end{center}
\caption[The Box-Muller transform.]{\label{fig:boxmuller} The Box-Muller transform. Initial circles shown uniformly spaced from the origin, are mapped to another set of circles that are not uniformly spaced but close near the origin and quickly spreading out.}
\end{figure}

% section box_mueller transform (end)

